#!/bin/bash
 
# 检查PID文件是否存在
if [ -f "./pid/server.pid" ]; then
  # 读取PID
  PID=$(cat ./pid/server.pid)
  # 检查进程是否存在
  if kill -0 "$PID" 2>/dev/null; then
    # 尝试优雅关闭进程
    kill "$PID"
  else
    echo "Process $PID does not exist"
  fi
else
  echo "PID file does not exist"
fi
